package at.guthy;

import java.io.File;

import javax.swing.JFileChooser;

import com.google.gdata.data.photos.AlbumEntry;
import com.google.gdata.util.AuthenticationException;

public class UploaderThread extends Thread {
	private File[] files;

	public UploaderThread(File[] files) {
		this.files = files;
	}

	public void run() {

		try {
			PicasaWindow.albumSelector.setEnabled(false);
			PicasaWindow.picturesTable.setEnabled(false);
			System.out.println("Folgende Files uploaden:");

			PicasaClient.getInstance().uploadPhotos(this.files, (AlbumEntry) PicasaWindow.albumSelector.getSelectedItem());
		}
		catch (AuthenticationException e) {
			PicasaWindow.progressBar.setString("HH");
		}
		finally {
			PicasaWindow.picturesTable.reload(((AlbumEntry) PicasaWindow.albumSelector.getSelectedItem()));
			PicasaWindow.albumSelector.setEnabled(true);
			PicasaWindow.picturesTable.setEnabled(true);
		}

		// this.src.setEnabled(true);
	}
}